<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11">
<html xml:lang="en" lang="en">
    <head>
        <link rel="stylesheet" href="<?php echo Yii::app()->theme->baseUrl?>/styles/reset.css" type="text/css" media="screen" />
        <link rel="stylesheet" href="<?php echo Yii::app()->theme->baseUrl?>/styles/form.css" type="text/css" media="screen" />
        <link rel="stylesheet" href="<?php echo Yii::app()->theme->baseUrl?>/styles/toolbar.css" type="text/css" media="screen" />
        <link rel="stylesheet" href="<?php echo Yii::app()->theme->baseUrl?>/styles/general.css" type="text/css" media="screen" />
        <link rel="stylesheet" href="<?php echo Yii::app()->theme->baseUrl?>/styles/login.css" type="text/css" media="screen" />
        <?php Yii::app()->ClientScript->registerCoreScript('jquery'); ?>
        <style type="text/css">
        
        </style>
    </head>
    
    <body>
        <div id="header"></div>        
        <div id="main">
            <div class="inner">
				<div class="login">
					<div class="form">    
                        <?php
                            $form=$this->beginWidget('CActiveForm', array(
                                'id'=>'user-login-form',
                                'enableAjaxValidation'=>false,
                                'enableClientValidation'=>true,
                                'clientOptions' => array(
                                    'validateOnSubmit' => true,
                                    'afterValidate'=>"js:function(form,data,hasError){
                                        if (!hasError)
                                        {
                                            var email = $('#AdminUser_email').val();
                                            $.post(
                                                '/index.php?r=Core/service/ajax',
                                                {
                                                    'SID' : 'User.AdminUser.forgotPassword',
                                                    'AdminUser[email]' : email 
                                                },
                                                function(data)
                                                {
                                                    var result = eval(data);
                                                    if (result.errors.ErrorCode)
                                                    {
                                                        var error = '';
                                                        for(var i in result.errors.ErrorCode)
                                                            error += result.errors.ErrorCode[i];
                                                        alert(error);
                                                    }
                                                    else
                                                    {
                                                        $('#form-section').hide();
                                                        $('#msg-send-success').show();        
                                                    }
                                                }
                                            );    
                                        }
                                        return false;
                                    }"
                                )
                            ));
                        ?>
                            <a href="#"><img src="<?php echo themeUrl(); ?>/images/Kodo-logo.png" class="icon" /></a>                        
                            <div id="msg-send-success" style="display: none;">
                                <p>An email with yours reset password information has been sent to you.</p>
                                <p syle="margin-top: 10px;"><?php echo FHtml::link('Back to login', $this->createUrl('/Admin/default/login'), array('title' => 'Back to login')); ?></p>
                            </div>
                            <div id="form-section">
                                <p>Reset your password.</p>
                                <div class="row">
                                    <?php echo $form->labelEx($user,'email'); ?>
                                    <?php echo $form->textField($user, 'email'); ?>
                                    <?php echo $form->error($user,'email'); ?>
                                </div>                       
                                <div class="row buttons">
                                      <?php echo CHtml::submitButton('Reset', array('class'=>'submit-button','style'=>'margin-left: 14px;')); ?>
                                      <?php echo FHtml::link('Back to login', $this->createUrl('/Admin/default/login'), array('title' => 'Back to login')); ?>
                                </div>
                            </div>    
                        <?php $this->endWidget();
                        ?>                    
					</div>
					<div class="copyright">&copy; 2012 - Indition CMS Admin</div>
				</div>
                
            </div>
        </div>
        
        <div id="footer"></div>
    </body>
    <script>
    function CheckRemember()
    {
        if ($('#remember').attr('checked'))
            $('#remember').attr('checked', false);
        else
            $('#remember').attr('checked', true);
    }
    </script>
    <script type="text/javascript">        
        function sizeBox() {
            var w = $(window).width();
            var h = document.getElementsByTagName('html')[0].clientHeight
            $('.login').css('position', 'absolute');
           
            $('.login').css('left', w/2-($('.login').width()/2));
        }

        $(document).ready(function() {
            sizeBox();            
        });

        $(window).resize(function() {
            sizeBox();
        });

    </script>
</html>	
